<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script setup lang="ts">
import { onMounted } from 'vue'
import { useAppStore } from './stores/app'

// 使用应用状态管理
const appStore = useAppStore()

// 应用初始化
onMounted(async () => {
  // 检查是否在Electron环境中
  if (typeof window.electronAPI !== 'undefined') {
    // 获取应用版本
    try {
      const result = await window.electronAPI.system.getAppVersion()
      if (result.success) {
        appStore.setAppVersion(result.data)
      }
    } catch (error) {
      console.error('获取应用版本失败:', error)
    }
  } else {
    console.log('不在Electron环境中，跳过应用版本获取')
    // 设置默认版本用于开发环境
    appStore.setAppVersion('开发模式')
  }
})
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}
</style>